<template>
  <!-- 放置一个图标 -->
  <div>
    <!-- 需要对图标 进行动态的配置 -->
    <!-- 如果是非全屏状态 图片是向外扩散的 -->
    <!-- 如果是全屏状态 图标向内收缩的 -->

    <svg-icon
      :icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
      class="fullscreen"
      @click="toggleScreen"
    />
  </div>
</template>

<script>
import screenfull from 'screenfull'
export default {
  name: 'ScreenFull',
  data() {
    return {
      isFullscreen: false

    }
  },
  methods: {
    // 点击全屏
    toggleScreen() {
      screenfull.toggle()
      this.isFullscreen = !this.isFullscreen
    }
  }}
</script>

<style lang="scss" scoped>
.fullscreen {
  width: 20px;
  height: 20px;
  color: #fff;
  cursor: pointer;
}
</style>
